const seruser=require('../ser/user')
//增
const getzzz=async(ctx)=>{
    let res=await seruser.getzeng(ctx.request.body)
     if(res){
    ctx.body={
        code:200,
        message:'添加成功',
        data:res
    }
    } else{
        ctx.body={
        code:401,
        message:'添加失败',
        data:null
    }
    }
}

//删
const getsss=async(ctx,next)=>{
     let res=await seruser.getshan(ctx.request.body)
    if(res){
    ctx.body={
        code:200,
        message:'删除成功',
        data:res
    }
    } else{
        ctx.body={
        code:401,
        message:'删除失败',
        data:null
    }
    }
}

//改
const getggg=async(ctx)=>{
    let res=await seruser.getgai(ctx.request.body)
    if(res){
     ctx.body={
        code:200,
        message:'修改成功',
        data:res
    }
    } else{
        ctx.body={
        code:401,
        message:'修改失败',
        data:null
    }
    }
}

//查
const getuser=async(ctx,next)=>{
    let res=await seruser.getser(ctx.request.body)
    if(res){
    ctx.body={
        code:200,
        message:'查询成功',
        data:res
    }
    } else{
        ctx.body={
        code:401,
        message:'查询失败',
        data:null
    }
    }
    
}

module.exports={
    getzzz,
    getsss,
    getggg,
    getuser
}